import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
    state: () => {
        return {
            // 所有这些属性都将自动推断其类型
            id: '',
            name: '',
            avtarSrc: '',
            chatHistories: [
                {
                    sender: '',
                    content: '本站开发者欢迎你加入群聊',
                }
            ],
            gpt3Histories: [
                {
                    sender: 'gpt3',
                    content: '我是由gyk计算机协会运行的大语言模型，模型名称为qianxiao，模型版本为V1.0。欢迎您使用 GPT 3.0 请文明上网',
                }
            ],
        }
    },
    getters: {
        getGPT3Histories(state) {
            let temp = [];
            temp = Array.from(state.gpt3Histories)
            temp.reverse()
            return temp;
        },
        getChatHistories(state) {
            let temp = [];
            temp = Array.from(state.chatHistories)
            temp.reverse()
            return temp;
        }
    },
})
